$file1 = "ensembl_entrez.txt";
$file2 = "normalized_frma_custom_brainarray.txt";
open(BUFF1,$file1);
open(BUFF2,$file2);
open(WRBUFF,">out_normalized_frma_custom_brainarray.txt");
while($line = <BUFF1>)
{
	chomp $line;
	$line =~ s/\r//g;
	$line =~ s/\n//g;
	@array = split("\t",$line);
	$hi{$array[0]} = $array[1];
}

$line = <BUFF2>;
print WRBUFF $line;
while($line = <BUFF2>)
{
        chomp $line;
        $line =~ s/\r//g;
        $line =~ s/\n//g;
	@array = split("\t",$line);	
	@array1 = split("_",$array[0]);
	print $array1[0]."\n";
	if($hi{$array1[0]} ne "")
	{
		if($k{$hi{$array1[0]}} eq "k")
		{

		}
		else
		{	$k{$hi{$array1[0]}} = "k";
			print WRBUFF $hi{$array1[0]}."\t".$line."\n";
		}
	}
}
